<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="br.com.trabalho.entidades.Usuario"%>
<%@page import="br.com.trabalho.util.Util"%>
<%@page import="java.util.List"%>
<%@page import="br.com.trabalho.entidades.Receita"%>
<%@page import="br.com.trabalho.entidades.Receita"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link href="css/bootstrap.css" rel="stylesheet">
        <script src="js/bootstrap.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Administração do Portal</title>
        <style>
            .header{
                text-align: center;
            }
            footer{
                text-align: center;
            }
            .panel-heading{
                text-align: center;
            }
        </style>
    </head>
    <body>
        <%@ include file="template.jsp" %>
        <div class="container">
            <section class="col-sm-12 col-md-6 col-lg-6 col-6" style="min-height: 500px">
                <div class="panel panel-primary">
                    <div class="panel-heading">Receitas</div>
                    <table style="width: 100%;" class="table">
                        <tr>
                            <td>ID</td>
                            <td>Nome</td>
                            <td>--</td>
                            <td>--</td>
                        </tr>
                        <c:forEach var="receita" items="${sessionScope.RECEITAS}">
                            <tr>
                                <td><c:out value="${receita.id}" /></td>
                                <td><c:out value="${receita.nome}" /></td>
                                <td><a href='new_recipe.jsp?edit=true&id=<c:out value="${receita.id}" />'>Editar</a></td>
                                <td><a href='details.jsp?id=<c:out value="${receita.id}" />'>Vizualizar</a></td>
                            </tr>
                        </c:forEach>
                </table>
                </div>               
            </section>
            <section class="col-sm-12 col-md-6 col-lg-6 col-6" style="min-height: 500px">
                <div class="panel panel-primary">
                    <div class="panel-heading">Usuários</div>
                    <table style="width: 100%;" class="table">
                        <tr>
                            <td>ID</td>
                            <td>Nome</td>
                            <td>--</td>
                            <td>--</td>
                        </tr>
                        <c:forEach var="u" items="${sessionScope.USUARIOS}">
                            <c:if test="${sessionScope.USUARIO.id != u.id}">
                                <tr>
                                    <td>${u.id}</td>
                                    <td>${u.nome}</td>
                                    <td><a>Editar</a></td>
                                    <td><a href='admin?remove=${u.id}'>Remover</a></td>
                                </tr>
                            </c:if>
                        </c:forEach>
                    </table>
                </div>               
            </section>
        </div>
        <div style="clear: both"></div>
        <footer style="text-align: center;">
            <%@ include file="footer.jsp" %>
        </footer>
    </body>
</html>
